//
//  BaseViewController.m
//  QuickCure37
//
//  Created by 马文星 on 16/6/17.
//  Copyright © 2016年 Demos. All rights reserved.
//

#import "BaseViewController.h"
#import "UIViewController+JASidePanel.h"

@interface BaseViewController ()

@end

@implementation BaseViewController

#pragma mark
#pragma mark - 入口
- (void)viewDidLoad {
    [super viewDidLoad];

    [self setColor];
    
    [self setGoBackArrowHead];
    
}

#pragma mark
#pragma mark - 设置返回箭头
- (void)setGoBackArrowHead{
    
    //创建返回箭头按钮
    UIButton *backBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
    [backBtn setImage:[UIImage imageNamed:@"JianTou"] forState:UIControlStateNormal];
    
    //添加点击事件
    [backBtn addTarget:self action:@selector(goback) forControlEvents:UIControlEventTouchUpInside];
    
    //修改返回箭头
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:backBtn];
    
}

#pragma mark
#pragma mark - 返回箭头触发事件
- (void)goback{
    [self.navigationController popViewControllerAnimated:YES];
}

#pragma mark
#pragma mark - 设置颜色
-(void)setColor{

    //总体背景色
    self.view.backgroundColor = [UIColor whiteColor];
    
    //navigationBar颜色
    self.navigationController.navigationBar.barTintColor = kThemeColor;
    
}

#pragma mark
#pragma mark - home控制器
-(UINavigationController *)centerViewController{
    //侧滑的center控制器
    return (UINavigationController *)self.sidePanelController.centerPanel;
}

#pragma mark
#pragma mark - 登录控制器
-(UIViewController *)leftViewController{
    //侧滑的left控制器
    return (UIViewController *)self.sidePanelController.leftPanel;
}

#pragma mark
#pragma mark - 跳转到下一个控制器
-(void)jumpToNextViewController:(UIViewController *)newVC{
    
    //显示center控制器
    [self.sidePanelController showCenterPanelAnimated:YES];
    
    //右控制器跳转
    [self.centerViewController pushViewController:newVC animated:NO];
    
}
@end
